<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="button" id="butn1" value="点击" onclick="on()">
    <input type="button" id="butn2" value="点击" onclick="off()">



</body>
<script>
    function on() {
        alert("按钮已开启");
    }
    document.getElementById("butn2").onclick = function() {
        alert("按钮已关闭");
    }
</script>
</html>